package com.seuic.hnjiningposapp.hnapps.ui.activity;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.cardview.widget.CardView;

import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.SPStaticUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView;
import com.seuic.hnjiningposapp.R;
import com.seuic.hnjiningposapp.hnapps.base.BaseActivity;
import com.seuic.hnjiningposapp.hnapps.bean.BankDataBean;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.AutomaticOperationPopup;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.CashRemittanceSuccessPp;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.CounterfeitCurrencyDetectionPp;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.DealSuccessPopup;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.DealingPopup;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.ErrorPopup;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.InputPasswordPopup;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.OtherBanKCaPp;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.Other_cash_remitt_pp;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.PrintingPopup;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.ReadCardPopup;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.ReadCcP;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.RemittancePopup;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.SureDealPopup;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.SurePrintPopup;
import com.seuic.hnjiningposapp.hnapps.ui.view.dialog.VerifyCardPopup;
import com.seuic.hnjiningposapp.hnapps.util.Api;
import com.seuic.hnjiningposapp.hnapps.util.DealMoneyAndNumComparisonUtils;
import com.seuic.hnjiningposapp.hnapps.util.FTPUtils;
import com.seuic.hnjiningposapp.hnapps.util.FtpReadFileUtils;
import com.seuic.hnjiningposapp.hnapps.util.GetMoneyLvUtils;
import com.seuic.hnjiningposapp.hnapps.util.HttpUtils;
import com.seuic.hnjiningposapp.hnapps.util.HttpUtilsV2;
import com.seuic.hnjiningposapp.hnapps.util.MoneyUtils;
import com.seuic.hnjiningposapp.hnapps.util.PrintUtil;
import com.seuic.hnjiningposapp.hnapps.util.TimeUtils;
import com.seuic.posdsdk.pos_func.PosFuncs;
import com.socks.library.KLog;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * isjingkai
 * 2019年7月20日10:47:53
 * 现金汇款
 */

public class CashRemittanceActivity extends BaseActivity implements
        CounterfeitCurrencyDetectionPp.CounterfeitCurrencyDCallBack,
        OtherBanKCaPp.otherBnakCappOk, ErrorPopup.OnFinishCallbacked, CashRemittanceSuccessPp.CashRemittanceSuccess, Other_cash_remitt_pp.onCallBack, SureDealPopup.OnNextClicklistener, RemittancePopup.ClickCallback, InputPasswordPopup.ClickCallback, DealSuccessPopup.ClickCallback, SurePrintPopup.ClickCallback {
    //输入方式
    String input_type;
    //卡类型
    String CardType = "";
    //二磁信息
    String track2Data;
    //三磁信息
    String track3Data;
    //ic卡55信息
    String Field55;
    //银行卡号
    String card_num = "";
    @BindView(R.id.base_back_btn)
    LinearLayout baseBackBtn;
    @BindView(R.id.base_title_text)
    TextView baseTitleText;
    @BindView(R.id.re_select_ones_btn)
    Button reSelectOnesBtn;
    @BindView(R.id.re_select_others_btn)
    Button reSelectOthersBtn;
    @BindView(R.id.re_select_account_layout)
    LinearLayout reSelectAccountLayout;
    @BindView(R.id.re_input_handto_btn)
    LinearLayout reInputHandtoBtn;
    @BindView(R.id.re_input_read_btn)
    LinearLayout reInputReadBtn;
    @BindView(R.id.re_inputmoudle_layout)
    LinearLayout reInputmoudleLayout;
    @BindView(R.id.input_rnum_edtext)
    EditText inputnumEdtext;
    @BindView(R.id.input_gzbtn)
    Button inputGzbtn;
    @BindView(R.id.input_numokbtn)
    Button inputNumokbtn;
    @BindView(R.id.input_num_layout)
    LinearLayout inputNumLayout;
    @BindView(R.id.local_layout)
    CardView localLayout;
    @BindView(R.id.inputnum_rname_edtext)
    EditText inputnumRnameEdtext;
    @BindView(R.id.inputnum_rmoney_edtext)
    EditText inputnumRmoneyEdtext;
    @BindView(R.id.sel_banname_ed)
    EditText selBannameEd;
    @BindView(R.id.sxf_tx)
    TextView sxfTx;
    @BindView(R.id.search_bank)
    Button searchBank;
    @BindView(R.id.input_bankname_layout)
    RelativeLayout inputBanknameLayout;
    @BindView(R.id.search_sxf)
    Button searchSxf;
    @BindView(R.id.inputnum_rmoney_layout)
    RelativeLayout inputnumRmoneyLayout;

    private String pass_word = "";
    private String time;
    //流水号
    private int num;
    //银行号
    private String bind_num;
    //银行类型
    private String bank_type = "";
    //银行名
    private String bank_name;
    //操作类型 本行账户 还是他行账户
    private String make_type = "";
    //开户行机构号
    private String jgh;
    private String s_number;
    private String rwNUm;
    private String pz_nums;
    private PosFuncs posFuncs;
    boolean ones_Bnak = true;//是否本行交易
    private ReadCardPopup readcardPop;
    private BasePopupView readcardPopupView;
    private VerifyCardPopup verifycardPop;
    private BasePopupView verifycardPopupView;
    private RemittancePopup remittancePop;
    private BasePopupView remittancePopupView;
    private InputPasswordPopup inputpasswordPop;
    private BasePopupView inputpasswordPopupView;
    private DealingPopup dealingPop;
    private BasePopupView dealingPopupView;
    private DealSuccessPopup dealsuccessPop;
    private BasePopupView dealsuccessPopupView;
    private SurePrintPopup surePrintPop;
    private PrintingPopup printingPop;
    private BasePopupView printingPopupView;
    private BasePopupView surePrintPopupView;
    private String importmoney;
    private AutomaticOperationPopup automaticOperationPopup;
    private BasePopupView automaticOperationPopupView;
    private BaseActivity baseActivity;
    private BasePopupView sureDealPopupView;
    private SureDealPopup sureDealPopup;
    private ErrorPopup errorPopup;
    private BasePopupView errorPopupPpView;

    private OtherBanKCaPp otherBanKCaPp;
    private BasePopupView otherBanKCaPpView;

    private String[] banknames;
    private Other_cash_remitt_pp other_cash_remitt_pp;
    private BasePopupView other_cash_remitt_ppview;
    //加密的密码密文
    private String cipassword;
    private CashRemittanceSuccessPp cashRemittanceSuccessPp;
    private BasePopupView cashRemittanceSuccessPpView;
    //用户名
    private String card_username;
    //他行手续费
    private String serviceCharge = "";

    private String reserveFundAcctNo;
    private String reserveFundAcctName;
    private String openBrcNo;
    private String mServerSeqNo;
    private String make_time;

    //查询的银行名称
    private String bankName;
    //查询的银行行号
    private String bankNum = "";
    private CounterfeitCurrencyDetectionPp currencyDetectionPp;
    private BasePopupView currencyDetectionPpView;
    private String consumerSeqNo;
    private ReadCcP readCcP;
    private BasePopupView readCcPViewpp;

    @Override
    public int initView(Bundle savedInstanceState) {
        return R.layout.activity_cash_remittance;
    }


    @Override
    public void initData(Bundle savedInstanceState) {
        findViewById(R.id.base_back_btn).setVisibility(View.INVISIBLE);
        this.setTitleText("现金汇款");
        posFuncs = PosFuncs.getInstace();
        posFuncs.init(this);
        //确认验钞
        readCcP = new ReadCcP(this);
        readCcPViewpp = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(readCcP);
        currencyDetectionPp = new CounterfeitCurrencyDetectionPp(this, this);
        currencyDetectionPpView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(currencyDetectionPp);
        errorPopup = new ErrorPopup(this, this);
        errorPopupPpView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(errorPopup);
        cashRemittanceSuccessPp = new CashRemittanceSuccessPp(this, this);
        cashRemittanceSuccessPpView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .moveUpToKeyboard(false)
                .dismissOnTouchOutside(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(cashRemittanceSuccessPp);
        readcardPop = new ReadCardPopup(this);
        readcardPopupView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .moveUpToKeyboard(false)
                .dismissOnTouchOutside(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(readcardPop);
        verifycardPop = new VerifyCardPopup(this, this);
        verifycardPopupView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(verifycardPop);//验证账户信息界面
        remittancePop = new RemittancePopup(this, this, this);
        remittancePopupView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(remittancePop);//输入+核对汇款信息界面
        inputpasswordPop = new InputPasswordPopup(this, this);
        inputpasswordPopupView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(inputpasswordPop);//输入密码界面
        dealingPop = new DealingPopup(this, this);
        dealingPopupView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(dealingPop);//交易中界面
        dealsuccessPop = new DealSuccessPopup(this, this, this);
        dealsuccessPopupView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(dealsuccessPop);//交易成功界面
        surePrintPop = new SurePrintPopup(this, this, this);
        surePrintPopupView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(surePrintPop);//打印纸是否正常界面
        printingPop = new PrintingPopup(this, this);
        printingPopupView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(printingPop);//打印中界面
        sureDealPopup = new SureDealPopup(this, this);
        sureDealPopupView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(sureDealPopup);

        other_cash_remitt_pp = new Other_cash_remitt_pp(this, this);
        other_cash_remitt_ppview = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(other_cash_remitt_pp);
        inputnumEdtext.setOnEditorActionListener((v, actionId, event) -> {
            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
                if (ones_Bnak) {
                    searchUserName();
                }
            }
            return false;
        });

        new Thread(new Runnable() {
            @Override
            public void run() {
                FTPUtils.deleteFile(Api.FTPFILEADRESS, Api.FTPFILE);
            }
        }).start();
        //删除文件存储时对应目录下的文件
//        File file = new File(Api.FTPDOWNADRESSINFO);
//        file.delete();
    }

    /**
     * 查询手续费
     */
    private void searchserviceCharge() {
        if (inputnumRmoneyEdtext.getText().toString().equals("")) {
            ToastUtils.showLong("请输入您的汇款金额");
            return;
        }
        if (bankNum.equals("")) {
            ToastUtils.showLong("请选择银行");
            return;
        }
        card_num = inputnumEdtext.getText().toString();
        KLog.e("查询手续费");
        hideSoftKeyboard(CashRemittanceActivity.this);
        //查询交易次数交易金额
        showMakeHint("获取备付金信息...");
        HttpUtilsV2.getQueryBankCardInfo(SPStaticUtils.getString("CardNum"), new HttpUtilsV2.NetCallBack() {
            @Override
            public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody111) {
                openBrcNo = rspBody111.getString("OpenBrcNo"); //银行行号
                reserveFundAcctName = rspBody111.getString("AcctName");//姓名
                reserveFundAcctNo = rspBody111.getString("AcctNo");//卡号

                runOnUiThread(() -> {
                    dismissshowMakeHint();
                    showMakeHint("查询交易次数...");
                    HttpUtilsV2.getQueryAccountNorm(card_num, new HttpUtilsV2.NetCallBack() {
                        @Override
                        public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                            String DepositCount = rspBody.getString("DepositCount");
                            String DepositAmount = rspBody.getString("DepositAmount");
                            DealMoneyAndNumComparisonUtils.comparison(
                                    DealMoneyAndNumComparisonUtils.REMITTANCE,
                                    DepositCount,
                                    DepositAmount,
                                    (next, msg) -> {
                                        KLog.e(msg);
                                        if (next) {
                                            runOnUiThread(() -> {
                                                dismissshowMakeHint();
                                                showMakeHint("手续费查询...");
                                                HttpUtilsV2.getQueryServiceCharge(reserveFundAcctNo,
                                                        openBrcNo,
                                                        bankNum,
                                                        card_num,
                                                        inputnumRmoneyEdtext.getText().toString(),
                                                        new HttpUtilsV2.NetCallBack() {
                                                            @Override
                                                            public void onSuccess(String ServerSeqNo, String ConsumerSeqNo1, JSONObject rspBody1) {
                                                                runOnUiThread(() -> {
                                                                    dismissshowMakeHint();
                                                                    serviceCharge = rspBody1.getString("ServiceFee");
                                                                    sxfTx.setText("手续费 :" + GetMoneyLvUtils.getMoney(serviceCharge));
                                                                });
                                                            }

                                                            @Override
                                                            public void onError(String code, String msg) {
                                                                showErr(msg);
                                                            }
                                                        });
                                            });
                                        } else {
                                            runOnUiThread(() -> showErr(msg));
                                        }
                                    });


                        }

                        @Override
                        public void onError(String code, String msg) {
                            showErr(msg);
                        }
                    });
                });
            }

            @Override
            public void onError(String code, String msg) {
                showErr(msg);
            }
        });

    }

    private void searchUserName() {
        if (inputnumEdtext.getText().toString().equals("")) {
            ToastUtils.showLong("请输入卡号");
        } else {


            showMakeHint("正在查询收款人姓名");
            card_num = inputnumEdtext.getText().toString();
            KLog.e("查询收款人姓名");

            HttpUtilsV2.getQueryBankCardInfo(card_num, new HttpUtilsV2.NetCallBack() {
                @Override
                public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                    card_username = rspBody.getString("AcctName");
                    runOnUiThread(() -> {
                        dismissshowMakeHint();
                        inputnumRnameEdtext.setText(card_username);
                    });
                }

                @Override
                public void onError(String code, String msg) {
                    showErr(msg);
                }
            });
        }
    }

    @Override
    public void initEvent(Bundle savedInstanceState) {
        this.setBackBtClick(R.id.base_back_btn);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    public static void hideSoftKeyboard(Activity activity) {
        View view = activity.getCurrentFocus();
        if (view != null) {
            InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
            inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
        }
    }

    @OnClick({R.id.search_bank, R.id.search_sxf, R.id.re_select_ones_btn, R.id.re_select_others_btn, R.id.re_input_handto_btn, R.id.re_input_read_btn, R.id.input_gzbtn, R.id.input_numokbtn})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.search_bank:
                //查询银行
                if (selBannameEd.getText().toString().equals("")) {
                    ToastUtils.showLong("请输入银行信息");
                } else {
                    KLog.e("进行银行信息查询成功");
                    showMakeHint("正在查询银行信息");
                    //添加银行
                    hideSoftKeyboard(CashRemittanceActivity.this);
                    HttpUtilsV2.getQueryAliasBankCardInfo(selBannameEd.getText().toString().trim(), new HttpUtilsV2.NetCallBack() {
                        @Override
                        public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                            String datainfo = rspBody.getString("PS_BK_GRP");
                            Gson gson = new Gson();
                            List<BankDataBean> bankDataBeans = gson.fromJson(datainfo, new TypeToken<ArrayList<BankDataBean>>() {
                            }.getType());


                            KLog.e(bankDataBeans.size() + "size");

                            List<String> BankNames = new ArrayList<>();

                            for (int i = 0; i < bankDataBeans.size(); i++) {
                                BankNames.add(bankDataBeans.get(i).getBankName());
                            }

                            banknames = BankNames.toArray(new String[BankNames.size()]);

                            runOnUiThread(() -> {
                                dismissshowMakeHint();

                                new XPopup.Builder(CashRemittanceActivity.this)
                                        .asBottomList("请选择银行", banknames, (position, text) -> {
                                            selBannameEd.setText(text);
                                            bankName = text;
                                            bankNum = bankDataBeans.get(position).getBankNo();
                                        }).show();
                            });
                        }

                        @Override
                        public void onError(String code, String msg) {
                            showErr(msg);
                        }
                    });
                }
                break;
            case R.id.search_sxf:
                //查询手续费
                if (!ones_Bnak) {
                    searchserviceCharge();
                }
                break;
            case R.id.re_select_ones_btn:
                //点击选择了转本行账户
                reSelectAccountLayout.setVisibility(View.GONE);
                reInputmoudleLayout.setVisibility(View.VISIBLE);
                break;
            case R.id.re_select_others_btn:
                ones_Bnak = false;
                inputnumRnameEdtext.setEnabled(true);
                reSelectAccountLayout.setVisibility(View.GONE);
                reInputmoudleLayout.setVisibility(View.VISIBLE);
                break;
            case R.id.re_input_handto_btn:
                //选择手输账号
                CardType = "input";
                reInputmoudleLayout.setVisibility(View.GONE);
                localLayout.setVisibility(View.GONE);
                //验钞
                if (currencyDetectionPpView != null) {
                    currencyDetectionPpView.show();
                }
                break;
            case R.id.re_input_read_btn:
                //选择读取账户
                localLayout.setVisibility(View.GONE);
                if (!readcardPopupView.isShow()) {
                    readcardPopupView.show();
                    readCardTest();//读卡操作
                }
                CardType = "";
                break;
            case R.id.input_gzbtn:
                inputnumEdtext.setText("");
                inputnumRnameEdtext.setText("");
                inputnumRmoneyEdtext.setText("");
                selBannameEd.setText("");
                sxfTx.setText("手续费: 0.00");
                serviceCharge = "";
                localLayout.setVisibility(View.VISIBLE);
                inputNumLayout.setVisibility(View.GONE);
                reInputmoudleLayout.setVisibility(View.VISIBLE);
                break;
            case R.id.input_numokbtn:
                //输入账户 确定
                if (inputnumEdtext.getText().toString().equals("")) {
                    ToastUtils.showLong("请输入账号");
                    return;
                }
                if (inputnumRnameEdtext.getText().toString().equals("")) {
                    ToastUtils.showLong("请输入收款人姓名");
                    return;
                }
                if (inputnumRmoneyEdtext.getText().toString().equals("")) {
                    ToastUtils.showLong("请输入汇款金额");
                    return;
                }

                if (inputnumEdtext.getText().toString().length() < 15 || inputnumEdtext.getText().toString().length() > 20) {
                    ToastUtils.showLong("请输入正确的银行卡号");
                    return;
                }


                card_num = inputnumEdtext.getText().toString();

                if (ones_Bnak) {
                    //本行操作
//                    VerifyMsg();//验证账户信息
//                    showMakeHint();
                    inputNumLayout.setVisibility(View.GONE);
                    localLayout.setVisibility(View.GONE);

                    if (CardType.equals("input")) {
                        card_username = inputnumRnameEdtext.getText().toString();

                        doOnesInputBank();
                    } else {
                        doOnesBank();
                    }
                } else {
                    if (selBannameEd.getText().toString().equals("")) {
                        ToastUtils.showLong("请选择银行名");
                        return;
                    }
                    if (serviceCharge.equals("")) {
                        ToastUtils.showLong("请查询手续费");
                        return;
                    }


//                    sureDealPopupView.show();
//                    sureDealPopup.setmCardNum(inputnumEdtext.getText().toString());
//                    sureDealPopup.setmMoney(inputnumRmoneyEdtext.getText().toString());
//                    sureDealPopup.setmOperation_name("他行现金汇款");
//                    sureDealPopup.setmUserName(inputnumRnameEdtext.getText().toString());
//                    if (!remittancePopupView.isShow()) {
//                        remittancePop.setContent(bind_num, "");//卡号 和持卡人姓名
//                        remittancePopupView.show();
//                    }
                    inputNumLayout.setVisibility(View.GONE);
                    localLayout.setVisibility(View.GONE);

//                    if (CardType.equals("input")) {
//                        doOtherinputBank();
//                    } else {
                    doOtheerReadBanl();
//                    }

                }

                break;
        }
    }

    /**
     * 他行读取
     */
    private void doOtheerReadBanl() {
        otherBanKCaPp = null;

        otherBanKCaPpView = null;

        otherBanKCaPp = new OtherBanKCaPp(this, this);
        otherBanKCaPpView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(otherBanKCaPp);


        otherBanKCaPp.setBankName(bankName);
        otherBanKCaPp.setUsername(inputnumRnameEdtext.getText().toString());
        otherBanKCaPp.setMake_money(inputnumRmoneyEdtext.getText().toString());
        otherBanKCaPp.setSxf_tv(serviceCharge);
        otherBanKCaPp.setUsernum(card_num);
        otherBanKCaPpView.show();

    }

    /**
     * 本行输入
     */
    private void doOnesBank() {
        sureDealPopup = new SureDealPopup(this, this);
        sureDealPopupView = new XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .moveUpToKeyboard(false)
                .isRequestFocus(false)
                .hasShadowBg(false)
                .hasStatusBarShadow(false)
                .asCustom(sureDealPopup);

        KLog.e("确认显示汇款数据");
        sureDealPopup.setmCardNum(inputnumEdtext.getText().toString());
        sureDealPopup.setmMoney(GetMoneyLvUtils.getInputMoney(inputnumRmoneyEdtext.getText().toString()));
        sureDealPopup.setmOperation_name("本行现金汇款");
        sureDealPopup.setmUserName(inputnumRnameEdtext.getText().toString());
        sureDealPopupView.show();
    }

    /**
     * 本行
     */
    private void doOnesInputBank() {
        showMakeHint("获取账户信息...");
        HttpUtilsV2.getQueryBankCardInfo(card_num, new HttpUtilsV2.NetCallBack() {

            @Override
            public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                if (CardType.equals("input")) {
                    card_username = inputnumRnameEdtext.getText().toString();
                } else {
                    card_username = rspBody.getString("AcctName");
                }
                KLog.e(card_username + "card_username");
                runOnUiThread(() -> {
                    //客户信息获取成功
                    dismissshowMakeHint();
                    //黑名单验证
                    showMakeHint("黑名单验证...");
                    HttpUtilsV2.getCheckingBankCardBlacklist(card_num, card_username, new HttpUtilsV2.NetCallBack() {
                        @Override
                        public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                            runOnUiThread(() -> {
                                dismissshowMakeHint();
                                //黑名单验证
                                showMakeHint("查询交易次数...");
                                HttpUtilsV2.getQueryAccountNorm(card_num, new HttpUtilsV2.NetCallBack() {
                                    @Override
                                    public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                                        String DepositCount = rspBody.getString("DepositCount");
                                        String DepositAmount = rspBody.getString("DepositAmount");
                                        DealMoneyAndNumComparisonUtils.comparison(
                                                DealMoneyAndNumComparisonUtils.REMITTANCE,
                                                DepositCount,
                                                DepositAmount,
                                                (next, msg) -> {
                                                    KLog.e(msg);
                                                    if (next) {
                                                        runOnUiThread(() -> {
                                                            dismissshowMakeHint();
                                                            //黑名单验证
                                                            showMakeHint("查询备付金...");
                                                            HttpUtilsV2.getQueryBankCardInfo(SPStaticUtils.getString("CardNum"), new HttpUtilsV2.NetCallBack() {
                                                                @Override
                                                                public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                                                                    openBrcNo = rspBody.getString("OpenBrcNo");
                                                                    reserveFundAcctName = rspBody.getString("AcctName");
                                                                    reserveFundAcctNo = rspBody.getString("AcctNo");
                                                                    runOnUiThread(() -> {
                                                                        //获取备付金成功
                                                                        dismissshowMakeHint();
                                                                        if (CardType.equals("input")) {
                                                                            doOnesBank();
                                                                        } else {
                                                                            //验钞
                                                                            if (currencyDetectionPpView != null) {
                                                                                currencyDetectionPpView.show();
                                                                            }
                                                                        }


                                                                    });
                                                                }

                                                                @Override
                                                                public void onError(String code, String msg) {
                                                                    showErr(msg);
                                                                }
                                                            });
                                                        });
                                                    } else {
                                                        runOnUiThread(() -> {
                                                            showErr(msg);
                                                        });
                                                    }
                                                }
                                        );

                                    }

                                    @Override
                                    public void onError(String code, String msg) {
                                        showErr(msg);
                                    }
                                });

                            });
                        }

                        @Override
                        public void onError(String code, String msg) {
                            showErr(msg);
                        }
                    });

                });
            }

            @Override
            public void onError(String code, String msg) {
                ToastUtils.showLong(msg);
                finish();
            }
        });
    }

    /**
     * 确认输入信息
     */
    @Override
    public void onNext() {
        if (sureDealPopupView != null) {
            if (sureDealPopupView.isShow()) {
                sureDealPopupView.dismiss();
                //输入确定之后隐藏
                inputpasswordPop.setTitle("请输入您的备付金密码");
                inputpasswordPopupView.show();

            }
        }
    }

    /**
     * 不确认信息  返回上一部
     */
    @Override
    public void LastStep() {
        sureDealPopupView.dismiss();
        inputNumLayout.setVisibility(View.VISIBLE);
    }

    /**
     * 获取到输入密码
     *
     * @param password
     */
    @Override
    public void SendPassword(String password) {//返回输入的密码
        KLog.e("密码加密");
        KLog.e(password + "card_num" + reserveFundAcctNo);
        cipassword = HttpUtils.getResult(password, reserveFundAcctNo);

        //获取交易时间
        make_time = TimeUtils.getTimeData();
        inputpasswordPopupView.dismiss();
        KLog.e("输入密码成功之后，进行交易");

        if (ones_Bnak) {
            dealingPopupView.show();
            HttpUtilsV2.getTransfer(
                    reserveFundAcctNo,
                    reserveFundAcctName,
                    card_num,
                    card_username,
                    openBrcNo,
                    cipassword,
                    inputnumRmoneyEdtext.getText().toString(),
                    "1", "", "100002", new HttpUtilsV2.NetCallBack() {
                        @Override
                        public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                            mServerSeqNo = ServerSeqNo;
                            consumerSeqNo = ConsumerSeqNo;

                            //上传 冠字号
                            new Thread(() -> {
                                String DATA = FtpReadFileUtils.FtpSingleFileData(
                                        SPStaticUtils.getString("FTPIP"),
                                        SPStaticUtils.getInt("FTPCOMPORT"),
                                        SPStaticUtils.getString("FTPUSERNAME"),
                                        SPStaticUtils.getString("FTPUSEPASSWORD"),
                                        Api.FTPFILEADRESS,
                                        Api.FTPFILE);
                                if (!DATA.equals("")) {
                                    KLog.e(DATA + "DATA");
                                    String cccc = FtpReadFileUtils.analysisData(DATA);
                                    if (cccc != "" || !cccc.contains("_")) {
                                        HttpUtilsV2.upGzAndWNum(consumerSeqNo, cccc, new HttpUtilsV2.NetCallBack() {
                                            @Override
                                            public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                                                runOnUiThread(() -> {
                                                    KLog.e("进行本行转账汇款,交易成功,显示成功界面");
                                                    runOnUiThread(() -> {
                                                        dealingPopupView.dismiss();
                                                        cashRemittanceSuccessPpView.show();
                                                        cashRemittanceSuccessPp.setMoney(GetMoneyLvUtils.getInputMoney(inputnumRmoneyEdtext.getText().toString()));
                                                        cashRemittanceSuccessPp.setName("本行现金汇款");
                                                        cashRemittanceSuccessPp.setNum(card_num);
                                                        cashRemittanceSuccessPp.setUsername(card_username);
                                                    });

                                                });
                                            }

                                            @Override
                                            public void onError(String code, String msg) {
                                                ToastUtils.showLong(msg);
                                                runOnUiThread(() -> {
                                                    KLog.e("进行本行转账汇款,交易成功,显示成功界面");
                                                    runOnUiThread(() -> {
                                                        dealingPopupView.dismiss();
                                                        cashRemittanceSuccessPpView.show();
                                                        cashRemittanceSuccessPp.setMoney(GetMoneyLvUtils.getInputMoney(inputnumRmoneyEdtext.getText().toString()));
                                                        cashRemittanceSuccessPp.setName("本行现金汇款");
                                                        cashRemittanceSuccessPp.setNum(card_num);
                                                        cashRemittanceSuccessPp.setUsername(card_username);
                                                    });

                                                });
                                            }
                                        });

                                    } else {
                                        runOnUiThread(() -> {
                                            ToastUtils.showLong("冠字号数据错误");
                                            KLog.e("进行本行转账汇款,交易成功,显示成功界面");
                                            runOnUiThread(() -> {
                                                dealingPopupView.dismiss();
                                                cashRemittanceSuccessPpView.show();
                                                cashRemittanceSuccessPp.setMoney(GetMoneyLvUtils.getInputMoney(inputnumRmoneyEdtext.getText().toString()));
                                                cashRemittanceSuccessPp.setName("本行现金汇款");
                                                cashRemittanceSuccessPp.setNum(card_num);
                                                cashRemittanceSuccessPp.setUsername(card_username);
                                            });

                                        });
                                    }


                                } else {
                                    runOnUiThread(() -> {
                                        ToastUtils.showLong("冠字号数据读取失败");
                                        runOnUiThread(() -> {
                                            dealingPopupView.dismiss();
                                            cashRemittanceSuccessPpView.show();
                                            cashRemittanceSuccessPp.setMoney(GetMoneyLvUtils.getInputMoney(inputnumRmoneyEdtext.getText().toString()));
                                            cashRemittanceSuccessPp.setName("本行现金汇款");
                                            cashRemittanceSuccessPp.setNum(card_num);
                                            cashRemittanceSuccessPp.setUsername(card_username);
                                        });

                                    });
                                }
                            }).start();


                        }

                        @Override
                        public void onError(String code, String msg) {
                            if (code.equals("ECR36")) {
                                ToastUtils.showLong(msg);
                                inputpasswordPopupView = null;
                                inputpasswordPop = null;


                                inputpasswordPop = new InputPasswordPopup(CashRemittanceActivity.this, CashRemittanceActivity.this);

                                inputpasswordPopupView = new XPopup.Builder(CashRemittanceActivity.this)
                                        .dismissOnBackPressed(false)
                                        .dismissOnTouchOutside(false)
                                        .moveUpToKeyboard(false)
                                        .isRequestFocus(false)
                                        .hasShadowBg(false)
                                        .hasStatusBarShadow(false)
                                        .asCustom(inputpasswordPop);//
                                inputpasswordPopupView.show();
                            } else {
                                runOnUiThread(() -> {
                                    dismissshowMakeHint();
                                    showErr(msg);
                                });
                            }

                        }
                    });
        } else {
            KLog.e("他行转账汇款");

            //黑名单验证
            showMakeHint("验证密码...");
            HttpUtilsV2.getAccountPwdVerification(reserveFundAcctNo, cipassword, new HttpUtilsV2.NetCallBack() {
                @Override
                public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            dismissshowMakeHint();
                            dealingPopupView.show();
                            HttpUtilsV2.getTransfer(
                                    reserveFundAcctNo,
                                    reserveFundAcctName,
                                    inputnumEdtext.getText().toString(),
                                    inputnumRnameEdtext.getText().toString(),
                                    bankNum,
                                    cipassword,
                                    inputnumRmoneyEdtext.getText().toString(),
                                    "2",
                                    serviceCharge,
                                    "100003", new HttpUtilsV2.NetCallBack() {
                                        @Override
                                        public void onSuccess(String ServerSeqNo1, String ConsumerSeqNo1, JSONObject rspBody1) {
                                            mServerSeqNo = ServerSeqNo1;
                                            consumerSeqNo = ConsumerSeqNo1;
                                            //上传 冠字号
                                            new Thread(() -> {
                                                String DATA = FtpReadFileUtils.FtpSingleFileData(
                                                        SPStaticUtils.getString("FTPIP"),
                                                        SPStaticUtils.getInt("FTPCOMPORT"),
                                                        SPStaticUtils.getString("FTPUSERNAME"),
                                                        SPStaticUtils.getString("FTPUSEPASSWORD"),
                                                        Api.FTPFILEADRESS,
                                                        Api.FTPFILE);
                                                if (!DATA.equals("")) {
                                                    KLog.e(DATA + "DATA");
                                                    String cccc = FtpReadFileUtils.analysisData(DATA);
                                                    if (cccc != "" || !cccc.contains("_")) {
                                                        HttpUtilsV2.upGzAndWNum(consumerSeqNo, cccc, new HttpUtilsV2.NetCallBack() {
                                                            @Override
                                                            public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                                                                runOnUiThread(() -> {
                                                                    dealingPopupView.dismiss();
                                                                    cashRemittanceSuccessPpView.show();
                                                                    cashRemittanceSuccessPp.setMoney(GetMoneyLvUtils.getInputMoney(inputnumRmoneyEdtext.getText().toString()));
                                                                    cashRemittanceSuccessPp.setName("他行现金汇款");
                                                                    cashRemittanceSuccessPp.setNum(inputnumEdtext.getText().toString());
                                                                    cashRemittanceSuccessPp.setUsername(inputnumRnameEdtext.getText().toString());
                                                                });
                                                            }

                                                            @Override
                                                            public void onError(String code, String msg) {
                                                                runOnUiThread(() -> {
                                                                    ToastUtils.showLong(msg);
                                                                    dealingPopupView.dismiss();
                                                                    cashRemittanceSuccessPpView.show();
                                                                    cashRemittanceSuccessPp.setMoney(GetMoneyLvUtils.getInputMoney(inputnumRmoneyEdtext.getText().toString()));
                                                                    cashRemittanceSuccessPp.setName("他行现金汇款");
                                                                    cashRemittanceSuccessPp.setNum(inputnumEdtext.getText().toString());
                                                                    cashRemittanceSuccessPp.setUsername(inputnumRnameEdtext.getText().toString());
                                                                });
                                                            }
                                                        });

                                                    } else {
                                                        runOnUiThread(() -> {
                                                            ToastUtils.showLong("冠字号数据错误");
                                                            dealingPopupView.dismiss();
                                                            cashRemittanceSuccessPpView.show();
                                                            cashRemittanceSuccessPp.setMoney(GetMoneyLvUtils.getInputMoney(inputnumRmoneyEdtext.getText().toString()));
                                                            cashRemittanceSuccessPp.setName("他行现金汇款");
                                                            cashRemittanceSuccessPp.setNum(inputnumEdtext.getText().toString());
                                                            cashRemittanceSuccessPp.setUsername(inputnumRnameEdtext.getText().toString());
                                                        });
                                                    }


                                                } else {
                                                    runOnUiThread(() -> {
                                                        ToastUtils.showLong("冠字号数据读取失败");
                                                        dealingPopupView.dismiss();
                                                        cashRemittanceSuccessPpView.show();
                                                        cashRemittanceSuccessPp.setMoney(GetMoneyLvUtils.getInputMoney(inputnumRmoneyEdtext.getText().toString()));
                                                        cashRemittanceSuccessPp.setName("他行现金汇款");
                                                        cashRemittanceSuccessPp.setNum(inputnumEdtext.getText().toString());
                                                        cashRemittanceSuccessPp.setUsername(inputnumRnameEdtext.getText().toString());
                                                    });
                                                }
                                            }).start();


                                        }

                                        @Override
                                        public void onError(String code, String msg) {
                                            runOnUiThread(() -> {
                                                dismissshowMakeHint();
                                                showErr(msg);
                                            });
                                        }
                                    });
                        }
                    });

                }

                @Override
                public void onError(String code, String msg) {
                    if (code.equals("ECR36")) {
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                dismissshowMakeHint();
                                ToastUtils.showLong(msg);
                                inputpasswordPopupView = null;
                                inputpasswordPop = null;


                                inputpasswordPop = new InputPasswordPopup(CashRemittanceActivity.this, CashRemittanceActivity.this);

                                inputpasswordPopupView = new XPopup.Builder(CashRemittanceActivity.this)
                                        .dismissOnBackPressed(false)
                                        .dismissOnTouchOutside(false)
                                        .moveUpToKeyboard(false)
                                        .isRequestFocus(false)
                                        .hasShadowBg(false)
                                        .hasStatusBarShadow(false)
                                        .asCustom(inputpasswordPop);//
                                inputpasswordPopupView.show();
                            }
                        });

                    }
                }
            });

        }

    }

    /**
     * 确认打印  用不到这个
     */
    @Override
    public void OKPrint() {

    }

    /**
     * 成功信息界面 确认打印
     */
    @Override
    public void CashRemittance() {
        cashRemittanceSuccessPpView.dismiss();
        if (!surePrintPopupView.isShow()) {
            surePrintPopupView.show();
        }
    }

    /**
     * 开始打印
     */
    @Override
    public void ToPrint() {
        //请求电子印章

        if (surePrintPopupView.isShow()) {
            surePrintPopupView.dismiss();

            HttpUtilsV2.getElectronicSeal("1", new HttpUtilsV2.NetCallBack() {
                @Override
                public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                    runOnUiThread(() -> {
                        if (!printingPopupView.isShow()) {
                            printingPopupView.show();
                            //调用PrintUtil
                            if (ones_Bnak) {
                                PrintUtil.printThfwmOrElectronicCash(PosFuncs.getInstace(),
                                        make_time,
                                        "本行现金汇款",
                                        mServerSeqNo,
                                        card_username,
                                        card_num,
                                        MoneyUtils.packRequest(inputnumRmoneyEdtext.getText().toString()),
                                        rspBody.getString("ImgBase64"), new PrintUtil.onPrintinterface() {
                                            @Override
                                            public void success(String success) {
                                                PrintUtil.printThfwmOrElectronicCash2(PosFuncs.getInstace(),
                                                        make_time,
                                                        "本行现金汇款",
                                                        mServerSeqNo,
                                                        card_username,
                                                        card_num,
                                                        MoneyUtils.packRequest(inputnumRmoneyEdtext.getText().toString()),

                                                        rspBody.getString("ImgBase64"), new PrintUtil.onPrintinterface() {
                                                            @Override
                                                            public void success(String success) {
                                                                ToastUtils.showLong(success);
                                                                SPStaticUtils.put("ccsno", SPStaticUtils.getInt("ccsno", 1) + 1);


                                                                finish();
                                                            }

                                                            @Override
                                                            public void failed(String error) {
                                                                showErr(error);
                                                            }
                                                        });
                                            }

                                            @Override
                                            public void failed(String error) {

                                            }
                                        }
                                );
                            } else {
                                //他行
                                PrintUtil.printThfwmOrElectronicCash(PosFuncs.getInstace(),
                                        make_time,
                                        "他行现金汇款",
                                        mServerSeqNo,
                                        inputnumRnameEdtext.getText().toString(),
                                        inputnumEdtext.getText().toString().trim(),
                                        MoneyUtils.packRequest(inputnumRmoneyEdtext.getText().toString()),
                                        rspBody.getString("ImgBase64"), new PrintUtil.onPrintinterface() {
                                            @Override
                                            public void success(String success) {
                                                PrintUtil.printThfwmOrElectronicCash2(PosFuncs.getInstace(),
                                                        make_time,
                                                        "本行现金汇款",
                                                        mServerSeqNo,
                                                        inputnumRnameEdtext.getText().toString(),
                                                        inputnumEdtext.getText().toString().trim(),
                                                        MoneyUtils.packRequest(inputnumRmoneyEdtext.getText().toString()),
                                                        rspBody.getString("ImgBase64"), new PrintUtil.onPrintinterface() {
                                                            @Override
                                                            public void success(String success) {
                                                                ToastUtils.showLong(success);
                                                                SPStaticUtils.put("ccsno", SPStaticUtils.getInt("ccsno", 1) + 1);
                                                                finish();
                                                            }

                                                            @Override
                                                            public void failed(String error) {
                                                                showErr(error);
                                                            }
                                                        });
                                            }

                                            @Override
                                            public void failed(String error) {

                                            }
                                        }
                                );


                            }
                        }
                    });

                }

                @Override
                public void onError(String code, String msg) {
                    showErr(msg);
                }
            });
        }
    }


    /**
     * 读取卡
     */
    private void readCardTest() {
        Log.e("读取卡", "readCardTest: 开始读卡");

        readCard(new HttpUtils.BaseReadCardListener() {
            @Override
            public void onSuccess(String data, String track2Data) {
                card_num = data;
                //如果选择本行卡交易  进行验证
                //data  本行卡数据
                //返回成功  输入密码ui
                KLog.e("读卡成功");
                readcardPopupView.dismiss();
                if (!ones_Bnak) {


                    currencyDetectionPpView.show();
                } else {
                    verifycardPopupView.show();
                    HttpUtilsV2.getCheckingThisBank(data, new HttpUtilsV2.NetCallBack() {
                        @Override
                        public void onSuccess(String ServerSeqNo, String ConsumerSeqNo, JSONObject rspBody) {
                            runOnUiThread(() -> {
                                if (verifycardPopupView.isShow()) {
                                    verifycardPopupView.dismiss();
                                    KLog.e("验证本行账户成功");
                                    doOnesInputBank();
                                }
                            });
                        }

                        @Override
                        public void onError(String code, String msg) {
                            showErr(msg);
                        }
                    });

                }

            }

            @Override
            public void onError(String msg) {
                showErr(msg);
            }
        });

    }

    private void showErr(String msg) {
        runOnUiThread(() -> {
            errorPopup.setMsg(msg);
            errorPopupPpView.show();
        });
    }

    @Override
    public void OKRemittance(String money) {//核对信息后的钱数返回
        ToastUtils.showLong("核对信息后的钱数" + money);
        importmoney = money;
        remittancePopupView.dismiss();
        if (!inputpasswordPopupView.isShow()) {
            inputpasswordPop.setTitle("请输入您的备付金密码");
            inputpasswordPopupView.show();
        }
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }


    /**
     * 他行确认数据 上一步
     */
    @Override
    public void Otherlaststep() {
        localLayout.setVisibility(View.VISIBLE);

        other_cash_remitt_ppview.dismiss();
        inputNumLayout.setVisibility(View.VISIBLE);
    }

    /**
     * 他行确认数据 下一步
     */
    @Override
    public void OtherNext() {
        other_cash_remitt_ppview.dismiss();
        inputpasswordPop.setTitle("请输入您的备付金密码");
        inputpasswordPopupView.show();
    }


    @Override
    public void finished() {
        finish();
    }

    /**
     * 他行确定信息
     */
    @Override
    public void OtherSureinfonext() {
        otherBanKCaPpView.dismiss();
        inputpasswordPop.setTitle("请输入您的备付金密码");
        inputpasswordPopupView.show();
    }

    /**
     * 他行确认数据 上一步
     */
    @Override
    public void OnLast() {
        inputNumLayout.setVisibility(View.VISIBLE);
        otherBanKCaPpView.dismiss();
    }


    @Override
    public void CounterfeitCurrencyD() {
        //弹出输入取款信息

        currencyDetectionPpView.dismiss();
        if (!ones_Bnak) {
            searchSxf.setVisibility(View.VISIBLE);
            reInputmoudleLayout.setVisibility(View.GONE);
            localLayout.setVisibility(View.GONE);
            inputNumLayout.setVisibility(View.VISIBLE);
            inputnumEdtext.setText(card_num);
            inputBanknameLayout.setVisibility(View.VISIBLE);

            sxfTx.setVisibility(View.VISIBLE);

            if (!CardType.equals("input")) {
                inputnumEdtext.setEnabled(false);
            }
        } else {


            if (!CardType.equals("input")) {
                localLayout.setVisibility(View.GONE);
                reInputmoudleLayout.setVisibility(View.GONE);
                inputNumLayout.setVisibility(View.VISIBLE);
                inputnumEdtext.setText(card_num);
                inputnumRnameEdtext.setText(card_username);
                inputnumEdtext.setEnabled(false);
                inputnumRnameEdtext.setEnabled(false);
            } else {
                inputnumEdtext.setEnabled(true);
                inputnumRnameEdtext.setEnabled(true);

                inputNumLayout.setVisibility(View.VISIBLE);

                if (!ones_Bnak) {
                    //如果是他行
                    searchSxf.setVisibility(View.VISIBLE);
                    reInputmoudleLayout.setVisibility(View.GONE);
                    inputNumLayout.setVisibility(View.VISIBLE);
                    inputBanknameLayout.setVisibility(View.VISIBLE);
                    sxfTx.setVisibility(View.VISIBLE);
                } else {

                }
            }
        }

    }
}
